import React, {PropTypes, Component} from 'react';
import ReactDOM from 'react-dom';
import classNames from 'classnames';
import './index.scss';

export default class MainCmp extends Component{
    constructor(props) {
        super(props);
        this._closeSideBar = this._closeSideBar.bind(this);
        this._hideMenus = this._hideMenus.bind(this);
    }
    componentDidMount(){
        document.addEventListener('click',this._hideMenus, 'false');
    }
    componentWillUnmount(){
        document.removeEventListener('click', this._hideMenus);
    }

    _hideMenus(event){
        if($(event.srcElement).closest('.show-menu').length > 0){
            return ;
        }
        this._closeSideBar();
    }
    _closeSideBar(){
        $('#site').removeClass('with-menu');
    }

    render(){
        return (
            <ul className="nav text-right">
                <li className="menu">
                    <i className="icon icon-close-sm small left"
                       onClick={this._closeSideBar.bind(this)}></i>
                    <span>导航</span>
                </li>
                <li><a href="/community/index.html" >首页</a></li>
                <li><a href="/community/discovery">发现</a></li>
                <li><a href="/page/exhibition/index">策展</a></li>
                <li><a href="/community/designer">设计师</a></li>
                <li><a href="/page/contestv/index">赛事</a></li>
                {/*<li><a href="https://xiaba.shijue.me/?utm_source=shijueme&chid=812" target="_blank">下吧</a></li>*/}
                {/*<li><a href="/node/contractIllustration">签约</a></li>*/}
                {/*<li><a href="/node/adobeSales">Adobe CC</a></li>*/}
            </ul>
        );
    }
}

